package org.wmq.taskschedule.factory;

import org.springframework.beans.BeanUtils;
import org.wmq.taskschedule.algorithm.AlgorithmExecutor;
import org.wmq.taskschedule.algorithm.GrayscaleConversionExecutor;
import org.wmq.taskschedule.biz.model.DO.Param;

/**
 * 图像灰度化算法执行器工厂类
 * 实现AlgorithmExecutorFactory接口，用于创建GrayscaleConversionExecutor实例
 */
public class GrayscaleConversionExecutorFactory implements AlgorithmExecutorFactory {
    private static final GrayscaleConversionExecutorFactory instance = new GrayscaleConversionExecutorFactory();

    private GrayscaleConversionExecutorFactory() {}
    
    /**
     * 获取工厂实例
     * @return GrayscaleConversionExecutorFactory实例
     */
    public static GrayscaleConversionExecutorFactory getInstance() {
        return instance;
    }
    
    @Override
    public AlgorithmExecutor getAlgorithmExecutor(Param param) {
        GrayscaleConversionExecutor grayscaleConversionExecutor = new GrayscaleConversionExecutor();
        BeanUtils.copyProperties(param, grayscaleConversionExecutor);
        return grayscaleConversionExecutor;
    }
}